laravel verify email custom url

87

/**
* Set a callback that should be used when creating the email verification URL.
*
* @param  \Closure  $callback
* @return void
*/
public static function createUrlUsing($callback)
{
    static::$createUrlCallback = $callback;
}
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
    ...

    VerifyEmail::createUrlUsing(function ($notifiable) {
        $frontendUrl = 'http://cool-app.com/auth/email/verify';

        $verifyUrl = URL::temporarySignedRoute(
            'verification.verify',
            Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
            [
                'id' => $notifiable->getKey(),
                'hash' => sha1($notifiable->getEmailForVerification()),
            ]
        );

        return $frontendUrl . '?verify_url=' . urlencode($verifyUrl);
    });
}

Comments

Submit
0 Comments